package org.xxpay.pay.channel.yipay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

public class YipayConfig extends AbstractPaymentConfig {
    public static final String CHANNEL_NAME = "yipay";
    public static final String CHANNEL_NAME_YIPAY_ALIPAY_QR = CHANNEL_NAME + "_aliqr";
    public static final String CHANNEL_NAME_YIPAY_WX_H5 = CHANNEL_NAME + "_wxh5";
    public static final String CHANNEL_NAME_YIPAY_WX_QR = CHANNEL_NAME + "_wxqr";
    public static final String CHANMEL_NAME_YIPAY_ALIPAY_WAP = CHANNEL_NAME + "_alih5";

    public static final String RETURN_VALUE_SUCCESS = "00";
    public static final String ORDER_STATUS_SUCCESS = "SUCCESS";
    public static final String RESPONSE_RESULT_SUCCESS = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";
    public static final String RESPONSE_RESULT_OK = "OK"; // 返回上游成功
    public static final String DOMAIN = "http://www.junyaopay.com";
    public static final String QUERY_STRING_PAY = "/Pay_Index.html";
    public static final String QUERY_STRING_QUERY = "/Pay_Trade_query.html";
    public static final String QUERY_TRANS = "/Payment_Dfpay_add.html";
    public static final String QUERY_TRANS_QUERY = "/Payment_Dfpay_query.html";

    YipayConfig(String payParam){
        Assert.notNull(payParam, "init sft config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setPrivateKey(object.getString("privatekey"));
        setRequestUrl(object.getString("requestUrl"));
    }
}
